<?php
class Error extends Zend_Controller_Plugin_Abstract
{
	public function routeShutdown(Zend_Controller_Request_Abstract $request)
    {
		$main = Zend_Controller_Front::getInstance();
		$CONFIG = Zend_Registry::get('config');
		//echo $CONFIG->mode;exit;
		if($CONFIG->mode == 'staging')
		{
			$main->registerPlugin(new Zend_Controller_Plugin_ErrorHandler(array(
				'module'     => 'default',
				'controller' => 'Error',
				'action'     => 'error'
			)));
		}
		else
		{
			$main->throwExceptions(true);
		}
    }
}
?> 